package com.teng.web.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.teng.dto.UserContext;
import com.teng.entity.ModuleEntity;
import com.teng.service.ModuleService;
import com.teng.service.impl.ModuleServiceImpl;
@WebServlet("/system/module/list.do")
public class ModuleServlet extends HttpServlet{
	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		
		try {
			HttpSession session=req.getSession();
			UserContext uc=(UserContext)session.getAttribute("LOGIN");
			ModuleService ms=new ModuleServiceImpl();
			List<ModuleEntity> md=ms.list(uc.getId());
			
			req.setAttribute("md",md);
			req.getRequestDispatcher("/modulemanage/list.jsp").forward(req, resp);
		} catch (Exception e) {
			
			e.printStackTrace();
		}
	}
}
